//
// Created by hjie on 23-9-20.
//

#pragma once

#include <cstdint>
#include <cstring>
#include <mutex>
#include <string>
#include <memory>
#include <map>
#include <vector>

class NonceData
{
public:
    uint8_t m_nonce_data[16];
    int64_t m_update_time;
};

class NonceDataManager
{
public:
    NonceDataManager();
    void ProducerNonceData(bool save, std::string & nonce_data);
    std::string GetStringNonceData(uint8_t * nonce_data);
    void RefreshNonceData(const std::string & nonce_id);
    void NonceDataTimer();
    bool CheckNonceData(const std::string & nonce_data);
    void UpdateNonceData(const std::string & data, int64_t now_time = 0);
private:
    // 这个数据暂时没有什么用处-所以生成10秒之后直接删除调
    std::map<std::string, NonceData> m_nonce_map;
    std::mutex m_nonce_mtx;
};